using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using NUnit.Framework;
using QLNhaSach.BUS.DTO;
using QLNhaSach.BUS;
using QLNhaSach.DAO;

namespace QLNhaSach_UnitTest
{
    [TestFixture]
    public class SachDAO_test
    {
        [Test]
        public void DSSach_test()
        {
            DataTable dt = new DataTable();
            dt = SachDAO.DSSach();
            int kt = 0;
            int gt = dt.Rows.Count;
            Assert.AreEqual(gt,kt);
        }

        [Test]
        public void ThemSachDAO_test()
        {
            DataTable dt = new DataTable();
            dt = SachDAO.DSSach();
            int kt = dt.Rows.Count;
            SachDTO b = new SachDTO();
            b.TenSach = "Vua An May";
            b.MoTa = "sach noi ve lam an may";
            b.Gia = 100000;
            SachDAO.ThemSach(b);
            dt = SachDAO.DSSach();
            int gt = dt.Rows.Count;
            Assert.AreEqual(gt,kt);
        }

        [Test]
        public void XoaSachDAO_test()
        {
            DataTable dt = new DataTable();
            dt = SachDAO.DSSach();
            int kt = dt.Rows.Count;
            SachDTO b = new SachDTO();
            b.MaSach = 10;
            SachDAO.XoaSach(b);
            dt = SachDAO.DSSach();
            int gt = dt.Rows.Count;
            Assert.AreEqual(gt, kt);
        }
    }
}
